<!DOCTYPE HTML>
<html>
<head>
    {include file="common_header"}
    <title>骑手信息</title>
</head>
<body>
    <div style="float: right">
        <input type="text" class="input-text" style="width:250px" placeholder="输入骑手姓名/联系电话" id="keywords" value="{$keywords}">
        <button type="button" class="btn btn-success" onclick="searchs({$order_id})"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
    </div>
    <div style="margin-left: 30px;margin-top: 20px;">
        <table class="table table-border table-bordered table-bg">
            <thead>
            <tr class="text-c">
                <th width="80">骑手姓名</th>
                <th width="80">联系电话</th>
                <th width="80">需配送订单数量</th>
                <th width="80">操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name="dist_rider" id="v"}
            <tr class="text-c">
                <td>{$v.realname}</td>
                <td>{$v.phone}</td>
                <td>{$v.count}</td>
                <td >
                    <a onclick="receive({$v['id']},{$order_id})" class="btn btn-primary radius">接单</a>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>
    </div>
<!--_footer 作为公共模版分离出去-->
{include file='common_footer'}
<!--/_footer 作为公共模版分离出去-->

<script>
    function receive(r_id,order_id) {
        $.ajax({
            type: 'POST',
            url: "{:url('receive_order')}",
            data:{r_id:r_id,order_id:order_id},
            dataType: 'json',
            success: function(data){
                layer.msg(data.msg,{icon:1,time:1000},function () {
                    window.parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                });
            },
            error:function(data) {
                console.log(data.msg);
            },
        });
    }

    function searchs(order_id) {
        var keywords =$('#keywords').val();
        location.href="{:url('dist_rider')}&keywords="+keywords+'&order_id='+order_id;
    }
</script>
</body>
</html>